package com.app.newiptv.helper;


import com.app.newiptv.bean.HomePageBean;
import com.app.newiptv.bean.RequestDto;
import com.app.newiptv.callback.IRequestCallback;
import com.app.newiptv.callback.IRequestLisenter;
import com.app.newiptv.utils.OkGoUtil;

/**
 * Created by wendal on 2017/9/23.
 */

public class HomePageHelper {
    private IRequestCallback callback;
    private HomePageBean homePageBean;

    public HomePageHelper() {
    }

    public void setCallback(IRequestCallback callback) {
        this.callback = callback;
    }

    public void loadData(String url) {

        OkGoUtil<HomePageBean> okGoUtil = new OkGoUtil<>(HomePageBean.class, OkGoUtil.TYPE_DATA, new IRequestLisenter() {
            @Override
            public void onSuccessData(RequestDto dto) {
                if (callback != null && dto != null) {
                    callback.onLoadComplete("", 0, 0, dto.getData());
                }
            }

            @Override
            public void onErrer(int code, String errMsg) {

            }
        });
        okGoUtil.requestGet(url);
    }
}
